/*
 * CSceneVisualisationProxy.cpp
 *
 *  Created on: 06.01.2013
 *      Author: Kirill Blinov
 *      Copyright: LGPL
 */

#include "CSceneVisualisationProxy.h"
#include "Manager Resource/ManagerResource.h"

CSceneVisualisationProxy::CSceneVisualisationProxy( CGameWorld::CGameWorldUnitIterator* GameWorldUnits,
		                                            CGameCamera* GameCameras ) :
		                           gameWorldUnits(GameWorldUnits), gameCameras(GameCameras)
{

}

CSceneVisualisationProxy::~CSceneVisualisationProxy()
{

}

GLuint
CSceneVisualisationProxy::GetVertexArrayId()
{
	CResourceWarehouse* ResourceWarehouse = ResourceOwner::GetResourceWarehouse();
	return ResourceWarehouse->GetVertexArrayId();
}

GAME_OBJECT*
CSceneVisualisationProxy::GetGuiModel()
{
	CResourceWarehouse* ResourceWarehouse = ResourceOwner::GetResourceWarehouse();
	return ResourceWarehouse->GetGuiDummy();
}

std::vector<GAME_CAMERA*>
CSceneVisualisationProxy::GetGameCameras()
{
	return std::vector<GAME_CAMERA*>( 1, gameCameras->GetCurrentCamera() );
}

std::vector<GUI_ELEMENT*>
CSceneVisualisationProxy::GetGuiElements()
{
	CManagerGUI* GuiManager = CManagerGUI::GetInstance();
	return GuiManager->Draw();
}

std::vector<GAME_OBJECT*>
CSceneVisualisationProxy::GetGameObjects()
{
	std::vector<GAME_OBJECT*> Result;
	UINT WorldUnitsCount = gameWorldUnits->GetUnitsCount();
	Result.reserve( WorldUnitsCount );

	gameWorldUnits->ResetIterator( CGameWorld::CGameWorldUnitIterator::ITERATOR_POSITION_BEGIN );
	for ( UINT i = 0; i < WorldUnitsCount; i++ )
	{
		Result.push_back( gameWorldUnits->GetNextUnit()->GetVisualInfo() );
	}

	return Result;
}
